commonlibsse_ng\re\h/
hkBaseObject.rs

1//! # hkBaseObject
2//!
3//! This module defines the `hkBaseObject` struct, which represents the base object in the Havok physics system.
4
5use crate::re::offsets_rtti::RTTI_hkBaseObject;
6use crate::re::offsets_vtable::VTABLE_hkBaseObject;
7use crate::rel::id::VariantID;
8use core::ffi::c_void;
9
10#[repr(C)]
11#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
12pub struct hkBaseObject {
13    pub vtable: *const hkBaseObjectVtbl,
14}
15const _: () = assert!(core::mem::size_of::<hkBaseObject>() == 0x8);
16
17impl Default for hkBaseObject {
18    #[inline]
19    fn default() -> Self {
20        Self::new()
21    }
22}
23
24impl hkBaseObject {
25    /// Address & Offset of the runtime type information (RTTI) identifier.
26    pub const RTTI: VariantID = RTTI_hkBaseObject;
27
28    /// Address & Offset of the virtual function table.
29    pub const VTABLE: [VariantID; 1] = VTABLE_hkBaseObject;
30
31    /// Creates a new `hkBaseObject` with default values.
32    #[inline]
33    pub const fn new() -> Self {
34        Self { vtable: &HK_BASE_OBJECT_VTBL }
35    }
36}
37
38pub struct hkBaseObjectVtbl {
39    /// Destructor for `hkBaseObject` (represented as a virtual method in C++).
40    pub CxxDrop: unsafe extern "C" fn(this: *mut c_void),
41}
42impl hkBaseObjectVtbl {
43    const fn new() -> Self {
44        const unsafe extern "C" fn CxxDrop(_this: *mut c_void) {}
45
46        Self { CxxDrop }
47    }
48}
49
50static HK_BASE_OBJECT_VTBL: hkBaseObjectVtbl = hkBaseObjectVtbl::new();